'''
Created on 2018年9月10日

@author: lije
'''
from businessLayer.page_element.datastandard.datastandard_dir_add_pop_page import DirAddPopPage
from businessLayer.page_element.datastandard.datastandard_dir_page import  DirManagePage
from businessLayer.utilites.gvcommon import Common

class StandardDirManageFun():    
    
    def goto_add_directory_pop_page(self):
        DirManagePage().RootTree().wait_element_present()
        DirManagePage().RootTree().mouse_hover()
        Common().wait_sleep(2)
        DirManagePage().RootAdd().should_exist()
        DirManagePage().RootAdd().click()
        
    def set_directory_info(self,dir_info):
        DirAddPopPage().TxtDirName().check_and_input(dir_info['name'])
        DirAddPopPage().TxtDirShortName().check_and_input(dir_info['short_name'])
        DirAddPopPage().TxtDirDescription().check_and_input(dir_info['description'])
        DirAddPopPage().ChkAutoCreateSubDir().check_true_and_select(dir_info['auto_create'])
        
    def delete_directory(self,dir_name):
        DirManagePage().NodeByTitle(dir_name).mouse_hover()
        DirManagePage().NodeDelByTitle(dir_name).wait_present_and_click()